function ReverseSentence(str)
{
    // write code here
    var n = str.length - 1
    var left = n
    var right = 0
    var res = []
    while(left >= 0){
      while(left >= 0 && str[left] !== ' '){
        right = left
        while(left >= 0 && str[left] !== ' '){
          left--
        }
        res.push(str.slice(left+1,right+1))
      }
      left--
    }
    return res.join(' ')
}
module.exports = {
    ReverseSentence : ReverseSentence
};